const Router = require('koa-router')
const router = new Router()
const koaBody = require('koa-bodyparser');

const like = require('../model/like')

router.prefix('/shouye');

router.post('/like',koaBody(), async ctx => {
    const foodname = ctx.request.body.foodname;
    const rows = await like.GETLIKE(foodname);
    ctx.body = rows;
  }
)

router.post('/addlike',koaBody(), async ctx => {
    const foodname = ctx.request.body.foodname;
    const like_num = ctx.request.body.like_num;
    const rows = await like.ADDLIKE(foodname,like_num);
    ctx.body = rows;
  }
)
module.exports = router